css: Report sizes as absolute
authorBenjamin Otte <otte@redhat.com>
Tue, 3 Jul 2018 21:17:41 +0000 (23:17 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 4 Jul 2018 04:15:33 +0000 (06:15 +0200)
All PangoFontDescriptions that GTK creates now use
pango_font_description_set_absolute_size().

gtk/gskpango.c
gtk/gtkcssshorthandpropertyimpl.c

index 20bff5e9c2754fc7fbbcdd9e4c7f06153eae6ebb..ae4a6a81fe30e7386c84a835893adae85eb051c0 100644 (file)
@@ -127,10 +127,10 @@ gsk_pango_renderer_show_text_glyphs (PangoRenderer        *renderer,
     return;
 
   graphene_rect_init (&node_bounds,
-                      (float)x/PANGO_SCALE,
-                      (float)y/PANGO_SCALE + ink_rect.y,
-                      ink_rect.x + ink_rect.width,
-                      ink_rect.height);
+                      (float)x/PANGO_SCALE - 1.0,
+                      (float)y/PANGO_SCALE + ink_rect.y - 1.0,
+                      ink_rect.x + ink_rect.width + 2.0,
+                      ink_rect.height + 2.0);
 
   gtk_snapshot_get_offset (crenderer->snapshot, &x_offset, &y_offset);
   graphene_rect_offset (&node_bounds, x_offset, y_offset);
index aad46d86796609c6a315c8d28f3e2b42ff1e7597..f5c078009b63737a37d33771b958384a23fe1d4b 100644 (file)
@@ -1101,7 +1101,6 @@ pack_font_description (GtkCssShorthandProperty *shorthand,
 {
   PangoFontDescription *description;
   GtkCssValue *v;
-  double dpi;
 
   description = pango_font_description_new ();
 
@@ -1112,11 +1111,9 @@ pack_font_description (GtkCssShorthandProperty *shorthand,
       pango_font_description_set_family (description, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0)));
     }
 
-  v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("-gtk-dpi"))), query_data);
-  dpi = _gtk_css_number_value_get (v, 96);
   v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
   if (v)
-    pango_font_description_set_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE * 72 / dpi));
+    pango_font_description_set_absolute_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
 
   v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
   if (v)